#include "MyLinkList.h"

typedef struct PERSON {
    LinkNode node;
    char name[64];
    int age;
}Person;

void MyPrint(LinkNode* data) {
    Person* p = (Person*)data;
    printf("Name:%s Age:%d\n",p->name,p->age);
}

int main() {
    //创建链表
    LinkNode* list = Init_LinkList();
    //创建数据
    Person p1,p2,p3,p4,p5;
    strcpy(p1.name,"aaa");
    strcpy(p2.name,"bbb");
    strcpy(p3.name,"ccc");
    strcpy(p4.name,"ddd");
    strcpy(p5.name,"eee");

    p1.age = 10;
    p2.age = 20;
    p3.age = 30;
    p4.age = 40;
    p5.age = 50;


    //将结点插入到链表
    Insert_LinkList(list,1,(LinkNode*)&p1);
    Insert_LinkList(list,2,(LinkNode*)&p2);
    Insert_LinkList(list,3,(LinkNode*)&p3);
    Insert_LinkList(list,4,(LinkNode*)&p4);
    Insert_LinkList(list,5,(LinkNode*)&p5);

    Print_LinkList(list,MyPrint);

    FreeSpace_LinkList(list);

    return 0;
}